package com.me.darkness_is_coming.actors;

import com.badlogic.gdx.graphics.g2d.Batch;
import com.me.darkness_is_coming.screens.GameScreen;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.math.Rectangle;
import com.badlogic.gdx.scenes.scene2d.Actor;

public class Cloud extends Actor
{
    private static final float ColiderDelta = Gdx.graphics.getDeltaTime()*0.012f;

    public enum CloudType {RED,GREEN,VIOLET,WHITE};

    private TextureRegion texture;
    private Rectangle Colider;
    CloudType type;
    int power;

    public Cloud(TextureRegion texture,float X,float Y,float Width,float Height,CloudType Type)
    {
        this.texture = texture;
        setSize(Width, Height);
        setPosition(X, Y);
        power = 0;
        type = Type;
        Colider = new Rectangle(getX()+ColiderDelta,getY()-ColiderDelta,getWidth()-ColiderDelta,getHeight()-ColiderDelta);
    }
    @Override
    public void act(float delta)
    {
        Colider.setX(getX());
        Colider.setY(getY() - Gdx.graphics.getHeight() * GameScreen.CloudMushroomSpeed * delta / (Gdx.graphics.getHeight()*0.12f));
        setPosition( getX(), getY() - Gdx.graphics.getHeight() * GameScreen.CloudMushroomSpeed * delta / (Gdx.graphics.getHeight()*0.12f));
    }
    public void setTextureRegion(TextureRegion region){
        texture = region;
    }

    @Override
    public void draw(Batch batch, float parentAlpha)
    {
        batch.setColor(getColor());
        batch.draw(texture, getX(), getY(), getWidth(), getHeight());
    }

    public void setFColor(CloudType color){type = color;}
    public void setPower(int Power){ power = Power;}
    public int getPower(){ return power;}
    public Rectangle getColider(){
        return Colider;
    }
    public CloudType getType(){
        return type;
    }
}
